URL = "http://downloads.sourceforge.net/project/gnuwin32/patch/%(VERSION)s/patch-%(VERSION)s-bin.zip"
VERSIONS = ["2.5.9-7"]
DEFAULT_VERSION = "2.5.9-7"

from source.builders import DownloadAndCopyBuilder
import shutil, os

class PatchBuilder(DownloadAndCopyBuilder):
  def install( self ):
    DownloadAndCopyBuilder.install(self)

    # Rename patch.exe to ptch.exe 
    # Windows 7 asks for administrator permissions when the filename contains 'patch'.

    src = os.path.join( self.targetpath(), "bin", "patch.exe" )
    tgt = os.path.join( self.targetpath(), "bin", "ptch.exe" )
    shutil.copy( src, tgt )

  def getpatchexec(self):
    return os.path.join( self.targetpath(), "bin", "ptch.exe" )


BUILDER = PatchBuilder
